﻿using DDDNorthWind.AC.ImportProducts.Domain.ValueObjects;
using DDDNorthWind.Core.Domain.ValueObject;

namespace DDDNorthWind.AC.ImportProducts.Domain.ValueObjects
{
    public class ImportProductSize : ValueObject<ImportProductSize>
    {
        public double High { get; set; }
        public double Width { get; set; }
        public double Length { get; set; }
        public ImportDimension DimensionIn { get; set; }


        #region "Equals"
        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override bool Equals(ImportProductSize other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.High.Equals(High)
                && other.Width.Equals(Width)
                && other.Length.Equals(Length)
                && Equals(other.DimensionIn, DimensionIn);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = High.GetHashCode();
                result = (result * 397) ^ Width.GetHashCode();
                result = (result * 397) ^ Length.GetHashCode();
                result = (result * 397) ^ DimensionIn.GetHashCode();
                return result;
            }
        }

        public static bool operator ==(ImportProductSize left, ImportProductSize right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(ImportProductSize left, ImportProductSize right)
        {
            return !Equals(left, right);
        }

        #endregion
        
    }
}